//
// Created by liushuai on 2021/2/6.
//

#include "maxPeakIndex.h"
int maxPeakIndex(int *a, int aLen) {
    for (int i = aLen-1; i >= 0; i--) {
        if (i == aLen - 1) {
            if (a[i]>= a[i-1])
                return i;
        } else if (i == 0) {
            if (a[i] >= a[i + 1])
                return i;
        } else {
            if(a[i]>=a[i-1]&&a[i]>=a[i+1])
                return i;
        }
    }
    return -1;
}

